/**
 * 
 */
package com.woupla.model;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.validation.constraints.NotNull;

/**
 * @author dimi
 *
 */
@Entity
public class Adress implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -2978008440611759227L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private int id;
	@NotNull
	@OneToOne
	private City city;
	private String nomRue;
	private int numRue;
	private String typeRue;
	private String complement;
	/**
	 * @return the city
	 */
	public City getCity() {
		return city;
	}
	/**
	 * @param city the city to set
	 */
	public void setCity(City city) {
		this.city = city;
	}
	/**
	 * @return the nomRue
	 */
	public String getNomRue() {
		return nomRue;
	}
	/**
	 * @param nomRue the nomRue to set
	 */
	public void setNomRue(String nomRue) {
		this.nomRue = nomRue;
	}
	/**
	 * @return the numRue
	 */
	public int getNumRue() {
		return numRue;
	}
	/**
	 * @param numRue the numRue to set
	 */
	public void setNumRue(int numRue) {
		this.numRue = numRue;
	}
	/**
	 * @return the typeRue
	 */
	public String getTypeRue() {
		return typeRue;
	}
	/**
	 * @param typeRue the typeRue to set
	 */
	public void setTypeRue(String typeRue) {
		this.typeRue = typeRue;
	}
	/**
	 * @return the complement
	 */
	public String getComplement() {
		return complement;
	}
	/**
	 * @param complement the complement to set
	 */
	public void setComplement(String complement) {
		this.complement = complement;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Adress [city=" + city + ", nomRue=" + nomRue + ", numRue="
				+ numRue + "]";
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((complement == null) ? 0 : complement.hashCode());
		result = prime * result + id;
		result = prime * result + ((nomRue == null) ? 0 : nomRue.hashCode());
		result = prime * result + numRue;
		result = prime * result + ((typeRue == null) ? 0 : typeRue.hashCode());
		return result;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Adress other = (Adress) obj;
		if (complement == null) {
			if (other.complement != null)
				return false;
		} else if (!complement.equals(other.complement))
			return false;
		if (id != other.id)
			return false;
		if (nomRue == null) {
			if (other.nomRue != null)
				return false;
		} else if (!nomRue.equals(other.nomRue))
			return false;
		if (numRue != other.numRue)
			return false;
		if (typeRue == null) {
			if (other.typeRue != null)
				return false;
		} else if (!typeRue.equals(other.typeRue))
			return false;
		return true;
	}
	
	
}
